/*
 * @Description: 地图选择测试
 * @Author: Zhanghan
 * @Date: 2025-02-06 19:36:52
 * @LastEditTime: 2025-03-26 09:54:05
 * @LastEditors: Zhanghan
 */
import { useRef, useState } from "react";
import MapChoice from "@/components/MapChoice";

function MyCart() {
  const mapChoiceRef = useRef(null);
  const [locationInfo, setLocationInfo] = useState<any>({});

  const onConfirm = (val) => {
    console.log("🚀 ~ onConfirm ~ val:", val);
    setLocationInfo({ ...locationInfo, ...val });
  };

  return (
    <>
      <div className="mb-2">地图测试</div>
      <div className="mb-2">
        {locationInfo.address ?? "-暂无地址"}
        {locationInfo.lon ?? "-暂无经度"}
        {locationInfo.lat ?? "-暂无纬度"}
      </div>
      <MapChoice ref={mapChoiceRef} onConfirm={onConfirm} />
    </>
  );
}

export default MyCart;
